/*
 *  UserSettings.cpp
 *  Typeface Builder
 *
 *  Created by David Rowland on 01/12/2008.
 *  Copyright 2008 UWE. All rights reserved.
 *
 */

#include "UserSettings.h"

UserSettings::UserSettings()
{
	addAndMakeVisible(outputDestinationLabel = new Label ( T("outputDestinationLabel"), T("Output Destination:") ));
	outputDestinationLabel->setEditable(false);
	outputDestinationLabel->setFont(Font::Font(18.0f));
	
	addAndMakeVisible (destinationDirectory = new FilenameComponent (T("outputDestination"),
																	 File::getSpecialLocation(File::currentApplicationFile).getParentDirectory(),
																	 true, true, false,
																	 T("*.*"),
																	 String::empty,
																	 T("(choose the file output destination)")));
	//      destinationDirectory->addListener (this);
	destinationDirectory->setBrowseButtonText (T("browse"));
	
	addAndMakeVisible(binaryFileNameLabel = new Label(T("binaryFileNameLabel"), T("Binary File Name:")) );
	binaryFileNameLabel->setEditable(false);
	binaryFileNameLabel->setFont(Font::Font(18.0f));
	
	addAndMakeVisible(binaryFileName = new TextEditor(String("binaryFileName")));
	
	addAndMakeVisible (deleteTempButton = new ToggleButton (T("deleteTempButton")));
	deleteTempButton->setButtonText (T("Delete temporary font file after file generation"));
	deleteTempButton->setTooltip(T("Selecting this will delete the intermediate file created by the font serialisation process. The final .h and .cpp binary files are not affected"));
	deleteTempButton->setSize(getWidth(), 25);
	deleteTempButton->changeWidthToFitText();
	deleteTempButton->setToggleState (true, false);
}

UserSettings::~UserSettings()
{
	deleteAllChildren();
}

void UserSettings::resized()
{
	outputDestinationLabel->setBounds(0, 0, getWidth(), 25);
	destinationDirectory->setBounds(0, 30, getWidth(), 25);
	binaryFileNameLabel->setBounds(0, 60, getWidth(), 25);
	binaryFileName->setBounds(0, 90, getWidth(), 25);
	deleteTempButton->setTopLeftPosition(0, 120);
}